﻿@inherits ProComponentBase

<SAutoComplete Value="Value"
               ValueChanged="ValueChanged"
               TValue="List<Guid>"
               TItem="UserSelectModel"
               TItemValue="Guid"
               Filter="FilterItem" NoFilter
               Items="Users"
                  Chips
               OnSearchInputUpdate="QuerySelection"
               Loading="_loading"
               Disabled=Readonly
               Label="@Label"
               ItemText="t=>TextView(t)"
               ItemValue="t=>t.Id"
                  Multiple
               Attach="true"
               Class="@Class">
    <SelectionContent Context="data">
        <MChip Close OnCloseClick="()=>Remove(data.Item)">
            @if (!string.IsNullOrEmpty(data.Item.Avatar))
            {
                <MAvatar Left>
                <MImage Src="@data.Item.Avatar"></MImage>
            </MAvatar>
            }
            <span class="body2 regular--text">
                @data.Item.DisplayName
            </span>
        </MChip>
    </SelectionContent>
    <ItemContent Context="data">
        @RenderFragments.UserSelectItem(data.Item.Avatar, data.Item.DisplayName, data.Item.PhoneNumber, data.Item.Account, data.Item.Email)
    </ItemContent>
</SAutoComplete>
